﻿using log4net.Core;
using Newtonsoft.Json;
using OSSUtility;
using Ozone.Device;
using Ozone.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace Models
{
    public class MethodItem
    {

        public int FNO { set; get; }


        public int SequenceId { set; get; }
        /*运行状态 0：未运行 
         *         1：等待中
         *         2：执行中
         *         3：保持中
         *         4：已完成 
         */
        [JsonIgnore]
        public int FStatus { set; get; }
        public string FStatusStr
        {
            get
            {
                if (FStatus == 0) return "未执行";
                if (FStatus == 1) return "96孔板位置1已成功放置";
                if (FStatus == 2) return "96孔板位置2已成功放置";
                if (FStatus == 3) return "96孔板配液中";
                if (FStatus == 4) return "96孔板配液完成";
                if (FStatus == 5) return "96孔板搬运至暗箱";
                if (FStatus == 6) return "96孔板搬运暗箱完成";
                if (FStatus == 7) return "暗箱拍照中";
                if (FStatus == 8) return "暗箱拍照完成";
                if (FStatus == 9) return "96孔板搬运至马弗炉";
                if (FStatus == 10) return "96孔板搬运至马弗炉完成";
                if (FStatus == 11) return "马弗炉焙烧中";
                if (FStatus == 12) return "马弗炉焙烧完成";
                if (FStatus == 13) return "96孔板搬运至冷却箱";
                if (FStatus == 14) return "96孔板搬运至冷却箱完成";
                if (FStatus == 15) return "冷却中";
                if (FStatus == 16) return "冷却完成";
                if (FStatus == 17) return "96孔板搬运至超声";
                if (FStatus == 18) return "超声中";
                if (FStatus == 19) return "超声完成";
                if (FStatus == 20) return "超声补液中";
                if (FStatus == 21) return "超声补液完成";
                if (FStatus == 22) return "96孔板搬运至光催化位置";
                if (FStatus == 23) return "96孔板搬运至光催化完成";
                if (FStatus == 24) return "光催化中";
                if (FStatus == 25) return "光催化完成";
                if (FStatus == 26) return "移动至回收位置";
                if (FStatus == 27) return "回收完成";
                if (FStatus == 28) return "超声补液完成";
                if (FStatus == 29) return "超声补液完成";
                if (FStatus == 30) return "超声补液完成";
                if (FStatus == 31) return "超声补液完成";
                if (FStatus == 32) return "执行完成";
                if (FStatus == 33) return "执行停止";
                if (FStatus == 100) return "反应最终收集产物完成";
                if (FStatus == 111) return "离心全流程失败";
                if (FStatus == 222) return "离心全流程失败";
                if (FStatus == -1) return "执行失败";
                return "";
            }
        }
        /// <summary>
        /// 配液方法名称
        /// </summary>
        public string DispensingMethodName { get; set; }
        /// <summary>
        /// 磁力加热温度
        /// </summary>
        public int IKATemp { get; set; }

        /// <summary>
        /// 磁力搅拌转速
        /// </summary>
        public int IKASpeed { get; set; }

        /// <summary>
        /// 加热时间
        /// </summary>
        public int IKATempTime { get; set; }
        /// <summary>
        /// 搅拌时间
        /// </summary>
        public int IKASpeedTime { get; set; }


        /// <summary>
        /// 馏分开始试管
        /// </summary>
        public int Fristtesttube { get; set; }

        /// <summary>
        /// 馏分结束试管
        /// </summary>

        public int Endtesttube { set; get; }

        /// <summary>
        /// 馏分容量
        /// </summary>
        public int LFCapacity { set; get; }


        /// <summary>
        /// 离心机速度
        /// </summary>
        public int CentrifugeSpeed { get; set; }


        /// <summary>
        /// 离心时间
        /// </summary>
        public int CentrifugeTime { get; set; }

        /// <summary>
        /// 离心机温度
        /// </summary>
        public int CentrifugeTemperature { get; set; }




        /// <summary>
        /// 离心机速度
        /// </summary>
        public int CentrifugeSpeedTwo { get; set; }


        /// <summary>
        /// 离心时间
        /// </summary>
        public int CentrifugeTimeTwo { get; set; }

        /// <summary>
        /// 离心机温度
        /// </summary>
        public int CentrifugeTemperatureTwo { get; set; }


        /// <summary>
        /// 流量计1流速
        /// </summary>
        public int Flow1 { get; set; }


        /// <summary>
        /// 流量计2流速
        /// </summary>
        public int Flow2 { get; set; }



        /// <summary>
        /// 超声功率
        /// </summary>
        public string ultrasoundPower { get; set; }


        /// <summary>
        /// 超声试管时间
        /// </summary>
        public int ultrasoundTime { get; set; }

        /// <summary>
        /// 超声旋蒸瓶时间
        /// </summary>

        public int ultrasoundXZTime { get; set; }


        /// <summary>
        /// 旋蒸温度
        /// </summary>
        public int RotaryTemp { get; set; }

        /// <summary>
        /// 旋蒸旋转速度
        /// </summary>
        public int RotarySpeed { get; set; }

        /// <summary>
        /// 旋蒸压强
        /// </summary>
        public int RotaryPa { get; set; }

        /// <summary>
        /// 旋蒸时间
        /// </summary>
        public int RotaryTime { get; set; }


        /// <summary>
        /// 柱塞泵 流速  进馏分使用
        /// </summary>
        public string OsskjPumpfolw { get; set; }

        /// <summary>
        /// 泵启动间隔时间   主要解决 两个泵进反应器由于管路和盘管不一样导致 一前一后 需要等待
        /// </summary>
        public string PumpintervalTime { get; set; }

        /// <summary>
        /// 板式反应器温度1 
        /// </summary>
        public string BSReactorHeat1 { get; set; }

        /// <summary>
        ///  板式反应器温度2
        /// </summary>
        public string BSReactorHeat2 { get; set; }

        /// <summary>
        /// 管式反应器温度
        /// </summary>
        public string GSReactorHeat { get; set; }

        /// <summary>
        /// 加热泵流速
        /// </summary>
        public string HeatPumpFlow { get; set; }

        /// <summary>
        /// 加热泵通道1温度
        /// </summary>
        public string HeatPump1 { get; set; }


        /// <summary>
        /// 加热泵通道2温度
        /// </summary>
        public string HeatPump2 { get; set; }


        /// <summary>
        /// 加热泵通道3温度
        /// </summary>
        public string HeatPump3 { get; set; }

        /// <summary>
        /// 加热泵通道4温度
        /// </summary>
        public string HeatPump4 { get; set; }

        /// <summary>
        /// 三工位补液1
        /// </summary>
        public string ThreeWorkBY1 { get; set; }

        /// <summary>
        /// 三工位补液2
        /// </summary>
        public string ThreeWorkBY2 { get; set; }

        /// <summary>
        /// 三工位补液3
        /// </summary>
        public string ThreeWorkBY3 { get; set; }


        /// <summary>
        /// 旋蒸柱塞泵流速
        /// </summary>
        public string XZOsskjPumpFlow { get; set; }

        /// <summary>
        /// 旋蒸柱塞泵补液体积
        /// </summary>
        public string XZOsskjPumpVolume { get; set; }

        /// <summary>
        /// 馏分试管列表
        /// </summary>
        public List<Testtube> ListTesttube { set; get; } = new List<Testtube>();


        public MethodItem()
        {
            #region  默认值
            //磁力加热温度
            IKATemp = 50;
            //磁力搅拌转速
            IKASpeed = 500;
            //磁力加热时间
            IKATempTime = 20;
            //磁力搅拌时间
            IKASpeedTime = 20;
            //馏分开始试管
            Fristtesttube = 1;
            //馏分结束试管
            Endtesttube = 10;
            //馏分容量
            LFCapacity = 80;
            //离心机速度
            CentrifugeSpeed = 12000;
            //离心时间
            CentrifugeTime = 20;
            //超声功率
            ultrasoundPower = "20000";
            //超声试管时间
            ultrasoundTime = 10;
            //超声旋蒸瓶时间
            ultrasoundXZTime = 20;
            //旋蒸温度
            RotaryTemp = 60;
            //旋蒸旋转速度
            RotarySpeed = 30;
            //旋蒸压强
            RotaryPa = 10;
            //旋蒸时间
            RotaryTime = 60;
            OsskjPumpfolw = "50";

            BSReactorHeat1 = "60";

            BSReactorHeat2 = "60";

            GSReactorHeat = "60";

            HeatPumpFlow = "50";

            HeatPump1 = "60";
            HeatPump2 = "60";
            HeatPump3 = "60";
            HeatPump4 = "60";

            ThreeWorkBY1 = "3";

            ThreeWorkBY2 = "3";

            ThreeWorkBY3 = "3";

            XZOsskjPumpFlow = "50";

            XZOsskjPumpVolume = "3";
            #endregion
        }
    }


    public class Testtube
    {
        /// <summary>
        /// 试管编号
        /// </summary>
        public int TesttubeNo { get; set; }
        /// <summary>
        /// 试管容量
        /// </summary>
        public int Capacity { get; set; }
        /*收集状态 0：未收集
        *         1：收集中
        *         2：收集完成
        */
        public int State { get; set; }



    }
}
